var windowName = "siteInfoSum";
apiready = function(){
    onWindowShow(function () {
    })
    onWindowHide(function () {
    })
    console.log("index page is OK");
    var imageBrowser = api.require('imageBrowser');
    var Page = createVM("#Page",{
        //页面数据
        tab:0,
        szqy:["青州","淄博"],
        zbdw:["青州","淄博"],
        from:{},
        value1:"送审信息",
        options:[
            "a","b","c","D"
            ,"a1","b1","c1","D1"
            ,"a2","b2","c2","D2"
            ,"a3","b3","c8","D3"
            ,"a4","b4","c3","D4"
            ,"a5","b5","c4","D5"
            ,"a6","b6","c5","D6"
            ,"a7","b7","c6","D7"
            ,"a8","b8","c7","D8"
            ,"a9","b9","c9","D9"
        ]
        ,pics:[
            picUserHead,
            picUserHead
        ]



        ,index:1
        ,id:1
        ,site:{}
        ,manager:{}
        ,matterPlan:[]
        ,matterLog:[]
        ,siteWorkLogs:[]
        ,userLogs:[]
        ,files:[]
        ,fileLogs:[]
        ,file:{}
        ,otherInfo:{}

    },{
        //页面方法
        "init":function () {
            var data = getData4Page()
            var _this  = this;
            console.log(data);
            this.id = data.id;
            showLoading()
            apiGet("/app/site/info/sum", {id:data.id}, function (res) {
                clearLoading();
                log(res)
                _this.site = res.data.site
                _this.manager = res.data.manager
                _this.matterPlan = res.data.matterPlan
                _this.matterLog = res.data.matterLog
                _this.siteWorkLogs = res.data.siteWorkLogs
                _this.userLogs = res.data.userLogs
                _this.files = res.data.files
                _this.file = res.data.file
                _this.otherInfo = res.data.otherInfo
                _this.fileLogs = res.data.fileLogs
            });
        }
        ,"show":function (index) {
            this.index = index
        }
        ,saveFile:function (url) {
            log(url)
        }
        ,showPic:function (index,pics) {
            imageBrowser.openImages({
                imageUrls: pics,
                activeIndex:index
            });
        }
        // ,download:function (url) {
        //     showToast("开始下载")
        //     var path = "/storage/emulated/0/qzyt/" + random_string() + get_suffix(url);
        //     api.download({
        //         url: url,
        //         savePath: path,
        //     }, function(ret, err) {
        //         logJson(ret)
        //         logJson(err)
        //         if (ret.state == 1) {
        //             //下载成功
        //             showToast("下载成功")
        //         } else {
        //
        //         }
        //     });
        // }
    })

    Page.init()

}

